using System;
using System.Collections.Generic;
using System.Text;
using LibrErian.Common;
using LibrErian.Model;
using LibrErian.Modules.BasicBook.Views.Library;
using Microsoft.Practices.CompositeUI.WinForms;
using LibrErian.Common.Constants;

namespace LibrErian.Modules.BasicBook
{
    public class EditLibraryController : WorkItemController
    {
        public Library Run(Library libraryToEdit)
        {
            WorkItem.State["Library"] = libraryToEdit;

            WindowSmartPartInfo info = new WindowSmartPartInfo();
            info.Title = "Edit Library";
            info.Modal = true;

            LibraryView view = WorkItem.SmartParts.AddNew<LibraryView>();

            WorkItem.Workspaces[WorkspaceNames.WindowWorkspace].Show(view, info);

            return WorkItem.State["Library"] as Library;
        }
    }
}
